package sanrenxing.dayEnd.backRepertoryTotal.dao;


import org.apache.ibatis.annotations.*;
import sanrenxing.dayEnd.backRepertoryTotal.domain.logMsg;

import java.util.List;

public interface LogMsgDao {
    @Insert("insert into logMsg values(#{logId},#{userId},#{IpAddress},to_date(#{visitTime},'yyyy-mm-dd hh24:mi:ss'),#{visitURL},#{execWay},#{execTime})")
    @SelectKey(statement = "select logMsgs.nextval from dual", keyProperty ="logId" ,keyColumn = "logId",before =true , resultType =Integer.class )
    public int add(logMsg lm);
    @Delete("delete from logmsg where logId=${logId}")
    public int del(int lm);
    @Select("select logId,userName,IpAddress,visitTime,visitURL,execWay,execTime from (select logId,userName,IpAddress,visitTime,visitURL,execWay,execTime,rownum r from logmsg join users on  logmsg.userId=users.userId where rownum<=${limit}) where 1=1 ${xx} and r>=${page}")
    public List<logMsg> all(@Param("xx") String xx, @Param("limit") int limit, @Param("page") int page);
    @Select("select count(*) from logmsg join users on  logmsg.userId=users.userId ${xx} ")
    public int count(String xx);


}
